<!--
 * @Author: WeiJin 3413105907@qq.com
 * @Date: 2023-12-10 11:20:06
 * @LastEditors: WeiJin 3413105907@qq.com
 * @LastEditTime: 2023-12-12 13:25:38
 * @FilePath: \rpsm-user\src\views\home\feeInfo\PaymentDetails.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>
        
        <el-table
        :data="payDetails"
        style="width: 100%">
        <el-table-column
          prop="pay_room_id"
          label="房间编号"
          width="180">
        </el-table-column>
        <el-table-column
          prop="pay"
          label="费用"
          width="180">
          <template slot-scope="scope">
            <span>{{ scope.row.pay / 100 }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="pay_date"
          label="缴费日期">
        </el-table-column>
        
        <el-table-column
        prop="pay_type"
        label="费用类型">
            <template slot-scope="scope">
                <span v-if="scope.row.pay_type === 1">水费</span>
                <span v-else-if="scope.row.pay_type === 2">电费</span>
                <span v-else-if="scope.row.pay_type === 3">物业费</span>
            </template>
        </el-table-column >
        
           
           
       
      </el-table>
    </div>
</template>

<style scoped>

</style>

<script>
import Axios from 'axios'
import {baseurl} from '@/param.js'

export default {
   name:'PaymentDetails',
//    computed:{
//         formattedPay() {
//             console.log(this.payDetails.map(item => item.pay / 100));
//             return this.payDetails.map(item => item.pay / 100);
//         }
//     },
   data(){
    
    return{
        userInfo:JSON.parse(sessionStorage.getItem('userInfo')),
        payDetails:[],
    }
   },
   mounted(){
    Axios.get(`${baseurl}//fee/details/${this.userInfo.userid}`,{
        headers:{
            Authorization:sessionStorage.getItem('Authorization')
        }
    })
    .then(res=>{
        if(res.data.code){
            this.payDetails = res.data.data 
        }
    }).catch(err=>alert(err.message))
    
    }
}
</script>
